<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <link rel="stylesheet" href="/assets/css/bootstrap.css" >
    <script src="/assets/js/jquery.min.js"></script>
    <script src="/assets/js/browser.js"></script>
    <script src="/assets/js/bootstrap.js"></script>
    <script src="/assets/js/ajaxfileupload.js"></script>
    <link rel="stylesheet" href="/assets/css/custom.css" >
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" >
        <div class="col-md-12" id="content" >
            <div class="app_content_div" id="app_content_div_301Index">
            </div>
        </div>

        <title>后台首页</title>
    </div>

<body>
<div class="navbar navbar-default">
    <div class="container">
        <div class="navbar-header">
            <button data-target=".navbar-collapse" data-toggle="collapse" type="button" class="navbar-toggle collapsed">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand hidden-sm">杨森多瑞吉管理后台</a>
        </div>
    </div>
    <div style="float:right;font-size:14px;">admin,欢迎您！<a href="/adm/logout">退出</a>&nbsp;&nbsp;&nbsp;</div>
</div>
<div class="container-fluid">
    <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
            <div class="accordion" id="accordion-11">
                <div class="accordion-group">
                    <div class="accordion-heading">
                        <a class="accordion-toggle" href="/adm">
                            首页
                        </a>
                    </div>
                </div>
                <div class="accordion-group">
                    <div class="accordion-heading">
                        <a class="accordion-toggle" href="/adm/user">
                            用户管理
                        </a>
                    </div>
                </div>
                <div class="accordion-group">
                    <div class="accordion-heading">
                        <a class="accordion-toggle" href="/adm/expert">
                            专家管理
                        </a>
                    </div>
                </div>
                <div class="accordion-group">
                    <div class="accordion-heading">
                        <a class="accordion-toggle" href="/adm/video">
                            直播/录播管理
                        </a>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" >
            <div class="col-md-12" id="content" >
                <div class="app_content_div" id="app_content_div_301Index">
        <h3>修改视频</h3>
    </div>

    <form class="form-horizontal" method="post" action="/adm/video">
        {{csrf_field()}}
        <input name="_token" type="hidden" value="">
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label"><span style="color:red;"></span>专家</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" style="width:300px;" id="name" name="name" value=" {{$avideo->name}}">
            </div>
        </div>
        <div class="form-group">
            <label for="type" class="col-sm-2 control-label"><span style="color:red;"></span>视频类型</label>
            <div class="col-sm-10">
                <label class="radio-inline">
                    <input type="radio" name="type" id="type" value="1" checked> 录播
                </label>
                <label class="radio-inline">
                    <input type="radio" name="type" id="type" value="0"> 直播
                </label>
            </div>
        </div>

        <div class="form-group">
            <label for="name" class="col-sm-2 control-label"><span style="color:red;"></span>标题</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" style="width:300px;" id="title" name="title" value=" {{$avideo->title}}">
            </div>
        </div>
        <div class="form-group">

            <label for="upload_file" class="col-sm-2 control-label"><span style="color:red;"></span>缩略图</label>
            <div class="col-sm-10">
                <input id="image" name="image" type="file"/>
            </div>
        </div>

        <div class="form-group">
            <label for="info" class="col-sm-2 control-label"><span style="color:black;">简介</span></label>
            <div class="col-sm-10">
                <input type="text" class="form-control" style="width:300px;" id="info" name="info"value=" {{$avideo->info}} ">
            </div>
        </div>
        <div class="form-group">
            <div class="form-group">
                <label for="upload_file" class="col-sm-2 control-label"><span style="color:red;"></span>视频</label>
                <div class="col-sm-10">
                    <input type="file" class="form-control" id="video" name="video"/>
                </div>
            </div>
            <div class="form-group">
                <label for="start_time" class="col-sm-2 control-label"><span style="color:red;"></span>开始时间</label>
                <div class="col-sm-10">
                    <input type="datetime-local" step="1" class="form-control ui_timepicker" id="start_at" name="start_at" value=" {{$avideo->start_at}}">
                </div>
            </div>
            <div class="form-group">
                <label for="end_time" class="col-sm-2 control-label"><span style="color:red;"></span>结束时间</label>
                <div class="col-sm-10">
                    <input type="datetime-local" step="1" class="form-control ui_timepicker" id="end_at" name="end_at" value=" {{$avideo->end_at}}">
                </div>
            </div>

            <div class="form-group">
                <label for="expert_id" class="col-sm-2 control-label"><span style="color:red;"></span>关联专家</label>
                <div class="col-sm-10" value=" {{$avideo->expert_id}}">
                    <select id="expert_id">
                        @foreach($oExpert as $v)
                            <option value="{{$v->id}}">姓名:{{$v->name}}
                            </option>
                        @endforeach
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
{{--                    <button type="button"  onclick="update()"  class="btn btn-default">确定</button>--}}
                    <button type="button" onclick="update()" class="btn btn-default">确定</button>

                </div>
            </div>
        </div>
    </form>
    <script>
        function update(){

            var name= $('#name').val();
            var type = $("[name='type']:checked").eq(0).val();
            var title= $('#title').val();
            var info = $('#info').val();
            var start = document.getElementById("start_at");
            var start_at = start.value.replace("T", " ");
            var end = document.getElementById("end_at");
            var end_at = end.value.replace("T", " ");
            var expert_id= $('#expert_id').val();
            $.ajaxFileUpload({
                url: '/adm/video/edit/1',
                type: 'post',
                fileElementId:'image',
                fileElementId:'video',
                dataType: 'json',
                data: {
                    'name': name,
                    'type': type,
                    'title':title,
                    'info': info,
                    'start_at': start_at,
                    'end_at': end_at,
                    'expert_id':expert_id,
                    '_token': '{{csrf_token()}}'
                },
                success: function (data) {
                    if (data.success) {
                        alert(data.msg);
                        location.href = '/adm/video';
                    } else {
                        alert(data.msg);
                    }
                }
            });

        }
    </script>
            </div>
        </div>
    </div>
</div>
</body>
</html>
